/*
 * Lenovo Group
 * Copyright (c) 2015-2016 All Rights Reserved.
 * Project Name: lmrp-android app
 * Create Time: 16-2-16 下午6:48
 */

package com.lenovo.mso2o.view;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;

/**
 * Created by hippo on 11/26/15.
 */
public class TabSelectListener extends TabLayout.ViewPagerOnTabSelectedListener{
    private final ViewPager mViewPager;

    public TabSelectListener(ViewPager viewPager) {
        super(viewPager);
        mViewPager = viewPager;
    }

    @Override
    public void onTabSelected(TabLayout.Tab tab) {
        //not scroll to if tab selected
        mViewPager.setCurrentItem(tab.getPosition(), false);
    }

    @Override
    public void onTabUnselected(TabLayout.Tab tab) {
        // No-op
    }

    @Override
    public void onTabReselected(TabLayout.Tab tab) {
        // No-op
    }
}
